<?php

class Controller
{
	public $params;
	public $view;
	
	public function run($handler, $params)
	{
		$this->params = $params;
		$sLayout = 'default.tpl';
		if ($aUser = getCurrentUser())
		{
		    $sLayout = $aUser['utype'].'.tpl';
		}
		$this->view = new View($sLayout);
		// extravert
		if (isset($GLOBALS['SUBLOGIN']) && $GLOBALS['SUBLOGIN'])
		{
			array_shift($this->params);
			array_unshift($this->params, $GLOBALS['SUBLOGIN']);
		}
		return $this->$handler();
	}
	
}